<!DOCTYPE html>
<html style="height: 100%">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title>打印采购入库单</title>
    <link rel="shortcut icon" href="/web/static/src/img/favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="/web/static/src/css/full.css">
    <link rel="stylesheet" href="/web/static/lib/fontawesome/css/font-awesome.css">
    <link rel="stylesheet" href="/web/static/lib/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="/web/static/src/css/base.css">

    <script language="javascript" src="/lodop/static/lib/lodop6/LodopFuncs.js"></script>
    <script language="javascript" src="/lodop/static/src/js/mathlibrary.js"></script>

    <style type="text/css" id="style">
        body{padding: 10px; font-size: 10pt}

        @media print
        {
            .print-hide {display:none}
        }

        .td_inline {
            display:block;
            overflow:hidden;
            white-space:nowrap;
            text-overflow:ellipsis;
            width: 370pt;
        }

        .nowrap{
            white-space:nowrap;
        }

        .curPre {

        }

        .table thead tr td{font-weight: bold; font-size: 11pt; }

        h4{margin: 0px;  padding: 0px;font-size: 14pt}

        h5{
            font-size:11pt; font-family:'黑体'; font-weight: bold; margin: 0px;  padding: 0px;
        }

        div{font-size: 10pt}

        span.foot_sign{border-bottom: 1px solid #ddd}

        .table tbody tr td{border-top: 1px solid #ddd;}
        .table tbody tr:last-child td{border-top: 1px solid #ddd;}
        .table tbody tr.memo td {padding:0px; border-top:0px }

        td{font-size:10pt}

        .font-middle{
            font-size: 12pt;
        }

        .page_head{
            padding-bottom: 20px;
        }

        .bottom-line{
            border-bottom:1px solid #DDD;
        }


    </style>
</head>

<body>
<object  id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0>
    <embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0></embed>
</object>

<!-- lodop 控制脚本 -->
<div class="controls controls-row print-hide">
    <script>
        function CheckIsInstall() {
            try{
                window.LODOP = getLodop(document.getElementById('LODOP_OB'),document.getElementById('LODOP_EM'));
                //if ((LODOP!=null)&&(typeof(LODOP.VERSION)!="undefined")) alert("本机已成功安装过Lodop控件!\n  版本号:"+LODOP.VERSION);
                return true;
            }catch(err){
                //alert("Error:本机打印控件未安装或需要升级!");
            }
        };
        //CheckIsInstall();

        function print_preview(){
            if (!LODOP.VERSION) return;
            LODOP.PRINT_INIT("采购入库单联单打印");
            LODOP.SET_PRINT_PAGESIZE(0, 2110, 1400, "2410x1400");

            var strStyle = "<style>" + document.getElementById("style").innerHTML + "</style>";
            //打印表头
            LODOP.ADD_PRINT_HTM(0,"10","100%",109, strStyle + document.getElementById("div-header").innerHTML);
            LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
            LODOP.SET_PRINT_STYLEA(0,"LinkedItem",1);

            //打印表身
            LODOP.ADD_PRINT_TABLE(100,"10","100%",380,strStyle + document.getElementById("div-body").innerHTML);
            LODOP.SET_PRINT_STYLEA(0,"Vorient",3);

            //打印表尾
            LODOP.ADD_PRINT_HTM(475,10,"90%",140, strStyle + document.getElementById("div-foot").innerHTML);
            LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
            LODOP.SET_PRINT_STYLEA(0,"FontSize",9);
            LODOP.ADD_PRINT_TEXT(475,690,135,20,"第#页/共&页");
            LODOP.SET_PRINT_STYLEA(0,"ItemType",2);
            //LODOP.SET_PRINT_STYLEA(0,"LinkedItem",1);
            //LODOP.ADD_PRINT_BARCODE(32,600,160,18,"EAN128C","${orderId}");
            LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);

            LODOP.PREVIEW();

        }


    </script>

    <a href="javascript:if (CheckIsInstall()){print_preview()}" class="btn btn-primary">联单打印预览</a>
    注: 点击按钮打印出库联单，打印A4纸按Ctrl+P键，或者菜单上面选择文件->打印，文件->页面设置里面可以去除页眉页脚

</div>

<!-- 出库单据表头 -->
<div id="div-header">
    <table border="0" cellSpacing="0" cellPadding="0" width="100%">
        <tbody>
        <tr>
            <td align="center"  colspan="3">
                <h4 class="page_head">{{purchase_order.company_id.name}}入库单</h4>
            </td>
        </tr>
        <tr>
            <td>
                <span style="font-size: 14px;font-weight: bold;">
                    订单编号: {{purchase_order.name}}
                </span>
            </td>
            <td>
                供应商:
                {% if purchase_order.partner_id.is_company %}
                {{ purchase_order.partner_id.name|default('', True) }}
                {% else %}
                {{ purchase_order.partner_id.parent_id.name|default('', True) }}
                {% endif %}
            </td>
            <td>
                下单日期:
                {%if purchase_order.date_order%}
                {{ purchase_order.date_order|strftime('%Y-%m-%d')}}
                {%endif%}
            </td>
        </tr>
        <tr>
            <td>
                联系人:
                {% if purchase_order.partner_id.is_company %}
                {{ purchase_order.partner_id.principal|default('', True) }}
                {% else %}
                {{ purchase_order.partner_id.name|default('', True) }}
                {% endif %}
            </td>
            <td colspan="2">
                电话:
                {% if purchase_order.partner_id.phone %}
                {{ purchase_order.partner_id.phone}}
                {% elif purchase_order.partner_id.mobile %}
                {{ purchase_order.partner_id.mobile}}
                {% endif %}
            </td>
        </tr>
        </tbody>
    </table>
</div>

<!-- 出库单据表身 -->
<div id="div-body">
    <table class="table table-striped" width="100%">
        <thead>
        <tr>
            <td width="55">序号</td>
            <td class="nowrap" colspan="4" style="text-align: left;">产品名称</td>
            <td class="nowrap" colspan="3" style="text-align: right;">计划入库数量</td>
            <td class="nowrap" style="text-align: right;">已入库数量</td>

        </tr>
        </thead>
        <tbody>
            {% for line in purchase_order.order_line %}
            <tr>
                <td align="left" >
                    {% if loop.index < 10 %}
                        0{{loop.index}}
                    {% else %}
                        {{loop.index}}
                    {%endif%}
                </td>
                <td colspan="4">
                    <span>
                        {{line.name}}
                    </span>
                </td>
                <td colspan="3" style="text-align: right;">
                    {{line.product_qty|int()}}
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            {% endfor %}
            {% if purchase_order.notes %}
            {% for line in purchase_order.notes.split('\n') %}
            <tr class="memo">
                <td colspan="9">
                    {% if loop.first %}备注:{% endif %}
                    {{ line }}
                </td>
            </tr>
            {% endfor %}
            {% endif %}
        </tbody>
    </table>



</div>

<!-- 出库单据表尾 -->
<div id="div-foot">

</div>

</body>
</html>
